package 线程安全;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Ticket implements Runnable {
    private static volatile int count = 100;

    @Override
    public void run() {
        while (count > 0) {

            try {
                count--;
                System.out.println(Thread.currentThread().getName() + ":卖出第" + count + "票");
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
